package com.stone.design.mode.pipeline.tomcat.valve;

import com.stone.design.mode.pipeline.tomcat.PipelineContext;
import lombok.extern.slf4j.Slf4j;

/**
 * AbstractPipelineValve
 *
 * @author wenpan 2023/11/17 9:53 下午
 */
@Slf4j
public abstract class AbstractPipelineValve implements PipelineValve {

    @Override
    public boolean execute(PipelineContext pipelineContext) {
        log.debug("{} start.", getClass().getName());
        boolean result = doExec(pipelineContext);
        log.debug("{} end, result is : {}.", getClass().getName(), result);
        return result;
    }

    /**
     * 执行
     *
     * @param pipelineContext context
     * @return boolean 执行结果
     * @author wenpan 2023/11/17 9:58 下午
     */
    protected abstract boolean doExec(PipelineContext pipelineContext);
}
